Systems and methods for flushing a cache with modified data

ABSTRACT

Systems and methods for flushing a cache with modified data are disclosed. Responsive to a request to flush data from a cache with modified data to a next level cache that does not include the cache with modified data, the cache with modified data is accessed using an index and a way and an address associated with the index and the way is secured. Using the address, the cache with modified data is accessed a second time and an entry that is associated with the address is retrieved from the cache with modified data. The entry is placed into a location of the next level cache.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is a continuation of U.S. patent applicationSer. No. 13/561,491, filed Jul. 30, 2012, entitled “SYSTEMS AND METHODSFOR FLUSHING A CACHE WITH MODIFIED DATA,” having attorney docket numberSMII-0176.US, which is herein incorporated by reference in its entirety.

A cache in a central processing unit is a data storage structure that isused by the central processing unit of a computer to reduce the averagetime that it takes to access memory. It is a memory which stores copiesof data that is located in the most frequently used main memorylocations. Cache memory is memory that is smaller in storage capacitythan main memory but is memory that can be accessed much more quickly.

A cache is considered to be full when it does not have space availableto accommodate incoming data. When a cache is full, writes to the cachecan be prevented from proceeding. Accordingly, write stalls can occuruntil a successful write-back or flushing of data that is maintained inthe cache is executed and space is created to accommodate the incomingdata.

Cache flushing removes an entry or entries from the cache such thatspace is freed for incoming data. The removal can be from the cache to anext level cache. This can be done either manually or automatically.

Some conventional caches are organized such that the contents of a lowerlevel cache are contained in a next higher level cache. Suchorganization can provide performance advantages and disadvantages.However, some higher level caches may not include the contents of thelower level cache. In particular, the cache line entries of a lowerlevel cache with modified data may not be included in the next levelcache. A problem can arise when cache line entries of a cache withmodified data that are not included in a next level cache needs to beflushed from the cache with modified data to the next level cache. If alower level cache is included in a higher level cache, it is enough toflush the higher level cache to the next higher level cache (relative toitself) or main memory. When a lower level cache is not included in ahigher level cache, the flush operation of this higher level cachecannot simultaneously effect the flushing of the lower level cache aswell.

A conventional approach to flushing cache line entries from a cache withmodified data to a next level cache in such circumstances is to stop thetraffic on one of the ports of the cache with modified data and toinject flush requests from that port to write-back cache line entriesfrom the cache with modified data one index and way at a time. However,this approach can have adverse timing impacts and has the potential todegrade performance. In addition, this approach can require a compleximplementation.

SUMMARY

Conventional approaches to flushing data from a cache with modified datato a next level cache can have adverse timing impacts that can degradeperformance. In addition, such approaches can require a compleximplementation. A method for flushing data from a lower level cache (acache with modified data in one embodiment) to a higher level (e.g., anext level cache) is disclosed that addresses these shortcomings.However, the claimed embodiments are not limited to implementations thataddress any or all of the aforementioned shortcomings. As a part of themethod, responsive to a request to flush data from a cache with modifieddata to a next level cache that does not include the cache with modifieddata, the cache with modified data is accessed using an index and a wayto secure the address associated with that index and the way. Using thisaddress, the cache with modified data is accessed a second time and anentry that is associated with the address is retrieved from the cachewith modified data. The entry is placed into a location of the nextlevel cache. The aforementioned methodology does not negatively impacttiming or degrade performance. In addition, the methodology is amenableto a straightforward implementation.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention, together with further advantages thereof, may best beunderstood by reference to the following description taken inconjunction with the accompanying drawings in which:

FIG. 1A shows an exemplary operating environment of a system forflushing a cache with modified data according to one embodiment.

FIG. 1B illustrates, responsive to a request to access a level twocache, the accessing of a store coalescing cache using an index and away to obtain an address corresponding to data that is to be flushed toa level two cache according to one embodiment.

FIG. 1C illustrates operations performed by a system for flushing acache with modified data according to one embodiment.

FIG. 2 shows components of a system for flushing a cache with modifieddata according to one embodiment.

FIG. 3 shows a flowchart of the steps performed in a method for flushinga cache with modified data according to one embodiment.

It should be noted that like reference numbers refer to like elements inthe figures.

DETAILED DESCRIPTION

Although the present invention has been described in connection with oneembodiment, the invention is not intended to be limited to the specificforms set forth herein. On the contrary, it is intended to cover suchalternatives, modifications, and equivalents as can be reasonablyincluded within the scope of the invention as defined by the appendedclaims.

In the following detailed description, numerous specific details such asspecific method orders, structures, elements, and connections have beenset forth. It is to be understood however that these and other specificdetails need not be utilized to practice embodiments of the presentinvention. In other circumstances, well-known structures, elements, orconnections have been omitted, or have not been described in particulardetail in order to avoid unnecessarily obscuring this description.

References within the specification to “one embodiment” or “anembodiment” are intended to indicate that a particular feature,structure, or characteristic described in connection with the embodimentis included in at least one embodiment of the present invention. Theappearance of the phrase “in one embodiment” in various places withinthe specification are not necessarily all referring to the sameembodiment, nor are separate or alternative embodiments mutuallyexclusive of other embodiments. Moreover, various features are describedwhich may be exhibited by some embodiments and not by others. Similarly,various requirements are described which may be requirements for someembodiments but not other embodiments.

Some portions of the detailed descriptions, which follow, are presentedin terms of procedures, steps, logic blocks, processing, and othersymbolic representations of operations on data bits within a computermemory. These descriptions and representations are the means used bythose skilled in the data processing arts to most effectively convey thesubstance of their work to others skilled in the art. A procedure,computer executed step, logic block, process, etc., is here, andgenerally, conceived to be a self-consistent sequence of steps orinstructions leading to a desired result. The steps are those requiringphysical manipulations of physical quantities. Usually, though notnecessarily, these quantities take the form of electrical or magneticsignals of a computer readable storage medium and are capable of beingstored, transferred, combined, compared, and otherwise manipulated in acomputer system. It has proven convenient at times, principally forreasons of common usage, to refer to these signals as bits, values,elements, symbols, characters, terms, numbers, or the like.

It should be borne in mind, however, that all of these and similar termsare to be associated with the appropriate physical quantities and aremerely convenient labels applied to these quantities. Unlessspecifically stated otherwise as apparent from the followingdiscussions, it is appreciated that throughout the present invention,discussions utilizing terms such as “accessing” or “identifying” or“placing” or the like, refer to the action and processes of a computersystem, or similar electronic computing device that manipulates andtransforms data represented as physical (electronic) quantities withinthe computer system's registers and memories and other computer readablemedia into other data similarly represented as physical quantitieswithin the computer system memories or registers or other suchinformation storage, transmission or display devices.

Exemplary Operating Environment of a System for Flushing a Cache withModified Data According to One Embodiment

FIG. 1A shows an exemplary operating environment 100 of a system 101 forflushing a cache with modified data according to one embodiment. System101 directs, in response to a periodic request to flush data from acache with modified data to a next level cache that does not include thecache with modified data, an access of the cache with modified databased on an index and way to secure (e.g., identify) an addressassociated with the data to be flushed. Subsequently, the address isused to access the cache with modified data a second time to obtain thedata to be flushed, which is then written into a location (e.g., index)of the next level cache. FIG. 1A shows system 101, L1 cache 103, L1store coalescing cache 103 a (e.g., cache with modified data), loadcache 103 b, CPU 105, L2 cache 107 (e.g., next level cache), L2 cachecontroller 107 a, main memory 109 and system interface 111. It should beappreciated that store coalescing cache 103 a is termed “cache withmodified data” as it maintains data that can be modified by stores thatupdate or modify the data.

Referring FIG. 1A, L1 cache 103 is a level 1 cache and L2 cache 107 is alevel 2 cache. In one embodiment, L1 cache 103 includes store coalescingcache 103 a and load cache 103 b. Store coalescing cache 103 a maintainsentries that are accessed by store request and load cache 103 bmaintains entries that are accessed by load requests. In one embodiment,store coalescing cache 103 a is a part of L1 cache 103 but is notincluded in L2 cache 107 (e.g., the next level cache). Requests to flushdata from store coalescing cache 103 a to L2 cache 107 which arereceived by L2 cache 107 involve obtaining an address from storecoalescing cache 103 a before store coalescing cache 103 a can be probedfor the information associated with the address. In one embodiment, theaccess of store coalescing cache 103 a is facilitated by a probe thatcouples L2 cache 207 and store coalescing cache 103 a (see FIG. 1B).

In one embodiment, because store coalescing cache 103 a is not includedin L2 cache 107, requests to flush store coalescing cache 103 a to L2cache 107 can cause stalls in the absence of a mechanism forfacilitating the acquisition by L2 cache 107 of information that isneeded to flush data from store coalescing cache 103 a to L2 cache 107.In one embodiment, this mechanism is provided by system 101, which as apart of its operation directs a securing of information from storecoalescing cache 103 a that is needed to access store coalescing cache103 a at the pipeline speed of L2 cache 107. In one embodiment, L2 cache107 controls the probe that is used to access and read data from storecoalescing cache 103 a.

Referring to FIG. 1B, system 101, responsive to a request to flush datafrom store coalescing cache 103 a to L2 cache 107, directs a probe ofstore coalescing cache 103 a using an index and a way to secure anaddress corresponding to data that is to be flushed to L2 cache 107 (seearrows corresponding to pipeline in FIG. 1B). In one embodiment, theaccess of store coalescing cache 103 a is facilitated by probe 113 thatis controlled by L2 cache 107. As a result of the probe, the address isprovided to L2 cache 107. Then, the address is used to probe storecoalescing cache 103 a a second time to obtain the data that is to beflushed from store coalescing cache 103 a. Thereafter, the data iswritten to L2 cache 107 (see arrows corresponding to pipeline). In oneembodiment, as shown in FIG. 1A, based on the operation of system 101,data is accessed and flushed from store coalescing cache 103 a at thespeed of the L2 cache pipeline. In one embodiment, system 101 can belocated in cache controller 107 a. In other embodiments, system 101 canbe separate from cache controller 107 a, but operate cooperativelytherewith.

Referring again to FIG. 1A, main memory 109 includes physical addressesthat store the information that is copied into cache memory. In oneembodiment, when the information that is contained in the physicaladdresses of main memory that have been cached is changed, thecorresponding cached information is updated to reflect the changes madeto the information stored in main memory. Also shown in FIG. 1A issystem interface 111.

Operation

FIG. 1C illustrates operations performed by a system for flushing acache with modified data according to one embodiment. These operations,which relate to flushing a cache with modified data are illustrated forpurposes of clarity and brevity. It should be appreciated that otheroperations not illustrated by FIG. 1C can be performed in accordancewith one embodiment.

Referring to FIG. 1C, at A, a request to flush data that is present in acache with modified data (e.g., store coalescing cache 103 a in FIG. 1A)that corresponds to a specific address is received.

At B, a probe of the cache with modified data (e.g., store coalescingcache 103 a in FIG. 1A), using the index and way where the data islocated in the cache with modified data, is executed.

At C, the address in the cache with modified data (e.g., storecoalescing cache 103 a in FIG. 1A) residing at the aforementioned indexand way is secured (e.g., identified) and provided to a next level cache(e.g., L2 cache 107 in FIG. 1A).

At D, the address is used to probe the cache with modified data a secondtime to obtain the data associated with the address.

At E, the data associated with the address in the cache with modifieddata is obtained and provided to the next level cache.

At F, the data is placed into a location of the next level cache. In oneembodiment, the flushing of a cache with modified data can be doneperiodically while the cache is idling and no stores are incoming.

Components of System for Flushing a Cache with Modified Data Accordingto One Embodiment

FIG. 2 shows components of a system 101 for flushing a cache withmodified data according to one embodiment. In one embodiment, componentsof system 101 implement an algorithm for flushing a cache with modifieddata. In the FIG. 2 embodiment, components of system 101 include flushrequest accessor 201, cache probe 203 and writing component 205.

Flush request accessor 201 accesses a request to flush data from a cachewith modified data to a next level cache. In one embodiment, the requestcan be one of an on-going series of periodic requests to flush data fromthe cache with modified data. In one embodiment, the flushing of datafrom the cache with modified data can be done to free up space for newerdata based on the expectation that newer data will be received. In oneembodiment, the request is directed to the next level cache (e.g., an L2cache).

Cache probe 203, responsive to the request to flush data from a cachewith modified data, accesses (e.g., probes) the cache with modified datausing an index and a way and identifies an address associated with theindex and way. Subsequently, using the address, cache probe 203 accesses(e.g., probes) the cache with modified data a second time and retrievesdata that is located at the location that is indicated by the index andway.

Writing component 205 places the data that is retrieved into a locationof the next level cache. In one embodiment, the contents of the cachewith modified data are not included in the next level cache and thusbefore an entry (e.g., cache line entry with data) from the cache withmodified data can be flushed to the next level cache, the addressassociated with the entry is obtained such that the entry can beidentified and flushed to the next level cache and placed into alocation there as a new entry.

It should be appreciated that the aforementioned components of system101 can be implemented in hardware or software or in a combination ofboth. In one embodiment, components and operations of system 101 can beencompassed by components and operations of one or more computercomponents or programs (e.g., cache controller 107 a in FIG. 1A). Inanother embodiment, components and operations of system 101 can beseparate from the aforementioned one or more computer components orprograms but can operate cooperatively with components and operationsthereof.

Method for Flushing a Cache with Modified Data According to OneEmbodiment

FIG. 3 shows a flowchart 300 of the steps performed in a method forflushing a cache with modified data according to one embodiment. Theflowchart includes processes that, in one embodiment can be carried outby processors and electrical components under the control ofcomputer-readable and computer-executable instructions. Althoughspecific steps are disclosed in the flowchart, such steps are exemplary.That is the present embodiment is well suited to performing variousother steps or variations of the steps recited in the flowchart.

Referring to FIG. 3, at 301, a request to flush data from a cache withmodified data to a next level cache is accessed. In one embodiment, therequest can be one of an on-going series of periodic requests that flushdata from the cache with modified data.

At 303, responsive to the request, a cache with modified data isaccessed using an index and a way. In one embodiment, the index and wayis used because the address associated with the desired entry is notavailable.

At 305, an address associated with said index and said way is secured(e.g., identified) from the cache with modified data. The securing ofthe address enables a subsequent retrieval of the entry associated withthe address.

At 307, using the address, the cache with modified data is accessed asecond time. In one embodiment, the access of the cache with modifieddata (in both 305 and 307) is executed using a probe that is controlledby the next level cache.

At 309, data is retrieved that is associated with the address. And, at311, the data is written into a location of the next level cache.

With regard to exemplary embodiments thereof, systems and methods forflushing a cache with modified data are disclosed. Responsive to arequest to flush data from a cache with modified data to a next levelcache that does not include the cache with modified data, the cache withmodified data is accessed using an index and a way and an addressassociated with the index and the way is secured. Using the address, thecache with modified data is accessed a second time and an entry that isassociated with the address is retrieved from the cache with modifieddata. The entry is placed into a location of the next level cache.

Although many of the components and processes are described above in thesingular for convenience, it will be appreciated by one of skill in theart that multiple components and repeated processes can also be used topractice the techniques of the present invention. Further, while theinvention has been particularly shown and described with reference tospecific embodiments thereof, it will be understood by those skilled inthe art that changes in the form and details of the disclosedembodiments may be made without departing from the spirit or scope ofthe invention. For example, embodiments of the present invention may beemployed with a variety of components and should not be restricted tothe ones mentioned above. It is therefore intended that the invention beinterpreted to include all variations and equivalents that fall withinthe true spirit and scope of the present invention.

What is claimed is:
 1. A method for flushing a cache with modified data, the method comprising: receiving a request to flush modified data from a first cache to a second cache; accessing the first cache using an index and way associated with the modified data; identifying a physical address of the modified data in the first cache based on the index and way associated with the modified data; providing the physical address of the modified data to the second cache; and accessing the first cache to retrieve the modified data using the physical address.
 2. The method of claim 1, further comprising: writing the modified data to a location within the second cache.
 3. The method of claim 2, wherein the modified data is retrieved from first cache and written to the location of the second cache at the pipeline speed of the second cache.
 4. The method of claim 1, wherein the second cache is at a higher level in a cache hierarchy than the first cache.
 5. The method of claim 1, wherein the modified data is not included in the second cache.
 6. The method of claim 1, wherein the second cache uses a cache probe to access the first cache using the index and way associated with the modified data, identify the physical address of the modified data in the first cache based on the index and way associated with the modified data, and retrieve the modified data using the physical address.
 7. The method of claim 1, wherein accessing the first cache to retrieve the modified data is performed by the second cache and in response to receiving the physical address of the modified data.
 8. A processor, comprising: a central processing unit; a first cache; and a second cache that includes a cache controller that includes: a flush request controller to process a request to flush modified data from the first cache to a second cache, and a cache probe to: access the first cache using an index and way associated with the modified data, identify a physical address of the modified data in the first cache based on the index and way associated with the modified data, and access the first cache to retrieve the modified data using the physical address.
 9. The processor of claim 8, wherein the cache controller further comprises: a writing component to write the modified data to a location within the second cache.
 10. The processor of claim 9, wherein the modified data is retrieved from first cache and written to the location of the second cache at the pipeline speed of the second cache.
 11. The processor of claim 8, wherein the second cache is at a higher level in a cache hierarchy than the first cache.
 12. The processor of claim 8, wherein the modified data is not included in the second cache.
 13. The processor of claim 8, wherein the cache probe is to access the first cache to retrieve the modified data in response to receiving the physical address of the modified data from the first cache.
 14. A non-transitory machine-readable medium that stores instructions, which when executed by a processor causes the processor to: process a request to flush modified data from a first cache to a second cache; access the first cache using an index and way associated with the modified data; identify a physical address of the modified data in the first cache based on the index and way associated with the modified data; provide the physical address of the modified data to the second cache; and access the first cache to retrieve the modified data using the physical address.
 15. The non-transitory machine-readable medium of claim 14, wherein the instructions further cause to the processor to: write the modified data to a location within the second cache.
 16. The non-transitory machine-readable medium of claim 15, wherein the modified data is retrieved from first cache and written to the location of the second cache at the pipeline speed of the second cache.
 17. The non-transitory machine-readable medium of claim 14, wherein the second cache is at a higher level in a cache hierarchy than the first cache.
 18. The non-transitory machine-readable medium of claim 14, wherein the modified data is not included in the second cache.
 19. The non-transitory machine-readable medium of claim 14, wherein the second cache uses a cache probe to access the first cache using the index and way associated with the modified data, identify the physical address of the modified data in the first cache based on the index and way associated with the modified data, and retrieve the modified data using the physical address.
 20. The non-transitory machine-readable medium of claim 14, wherein accessing the first cache to retrieve the modified data is performed by the second cache and in response to receiving the physical address of the modified data. 